package com.neuedu.autosale.cli.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.neuedu.autosale.cli.entity.Feedback;
import com.neuedu.autosale.cli.service.FeedbackService;
import com.neuedu.autosale.entity.Pager;
import com.neuedu.autosale.entity.Result;
import com.neuedu.autosale.mapper.FeedbackMapper;

@Service
@Transactional
public class FeedbackServiceImpl implements FeedbackService {
	@Autowired
	private FeedbackMapper feedbackMapper;
	
	@Override
	public List<Feedback> findListByPager(Pager<Feedback> pager){
		return feedbackMapper.findListBypager(pager);
	}
	
	@Override
	public Integer findTotalByPager(Pager<Feedback> pager) {
		return feedbackMapper.findTotalByPager(pager);
	}
	
	@Override
	public Result add(Feedback object) {
		Result result =new Result(false,"新增失败！");
		boolean ret=feedbackMapper.add(object);
		if(ret) {
			result=new Result(true,"新增成功！");
		}
		return result;
	}
	
	@Override
	public Result edit(Feedback object) {
		Result result =new Result(false,"修改失败！");
		boolean ret=feedbackMapper.edit(object);
		if(ret) {
			result=new Result(true,"修改成功！");
		}
		return result;
	}
	
	@Override
	public Result deleteByIds(List<Feedback> ids) {
		Result result =new Result(false,"删除失败！");
		boolean ret=feedbackMapper.deleteByIds(ids);
		if(ret) {
			result=new Result(true,"删除成功！");
		}
		return result;
	}
	
	@Override
	public List<Feedback> findAll(){
		return feedbackMapper.findAll();
	}
	

}
